home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 12812 < prev    next >
Encoding:
Text File  |  1996-08-05  |  3.4 KB  |  71 lines

  1. Newsgroups: comp.lang.c++
  2. Path: news.sprintlink.net!news1!news
  3. From: pbennett@acraline.com (Patrick Bennett)
  4. Subject: Re: Correctnes of BORLAND C++ RTTI Info in a multi threaded environment (WindowsNT)
  5. X-Nntp-Posting-Host: machine131.acraline.com
  6. Message-ID: <31518943.1725056@news.iquest.net>
  7. Sender: news@iquest.net (News Admin)
  8. Reply-To: pbennett@acraline.com
  9. Organization: Acraline Products
  10. X-Newsreader: Forte Agent .99c/16.141
  11. References: <315030FD.5898@isis.co.za>
  12. Date: Thu, 21 Mar 1996 17:01:08 GMT
  13.  
  14. Itsik Rubin <yr@isis.co.za> wrote:
  15. >Hello, I am using Borland C++ Version 4.51 under Windows NT I am developping
  16. >a 32 bit application that is intended for Windows NT and I use extensively
  17. >multi threading as wellas the streaming mechanism provided in the Borland
  18. >class library. This is used for inter thread , inter process and inter
  19. >processor (over a LAN) communication. The developped system is required to
  20. >run continuously 24 hours a day 7 days a week. Approximatly once a day I run
  21. >into a problem where during the operation of the system a stream becomes
  22. >corrupted. When I make the following change to the opstream::WriteData
  23. >method inside objstrm.cpp I get logs in both places (marked 1 and 2). Based
  24. >on my observation the first _TYPENAME(strmr) is erronous whereas the second
  25. >one returns correct results. This points to problems within the RTTI
  26. >mechanism. The following questions (at least) need answer: 
  27. > 1. Is typeinfo object, which is part of the Borland C++ RTTI, multi-thread safe? 
  28. > 2. Has anyone else encounted this problem? 
  29. > 3. Is there a fix for this problem? 
  30. [snip]
  31.  
  32. I ran into numerous problems with Borland and my multi-threaded apps
  33. whenever I threw exceptions.  It seemed like every time I threw an
  34. exception the thread involved became, well, hosed.  Early on, I
  35. thought it was a problem with one of the libraries/dll's that I was
  36. using, but after stumbling across a message from someone on CI$ about
  37. having to recompile the borland libraries for MT, I checked into it.
  38.  
  39. If you're using the Borland TThread class (why not, it's there, it
  40. works [well kinda!]) as I was, this is one cause of the problems.  If
  41. you look in the thread.cpp source you'll notice a few places that
  42. check for #ifdef __MT__ within the WIN32 section of the code, it MT
  43. isn't defined, it uses the WIN32 call CreateThread, if MT is defined
  44. then it uses the _beginthreadNT call.  Of course, you have to MANUALLY
  45. recompile the BIDS library so that the right call is made!!!!!!  If it
  46. uses CreateThread instead of _beginthreadNT then the RTL won't be
  47. properly set up for that thread.  Below is a quote from the online
  48. help on _beginthreadNT:
  49.  
  50.     All multithread Windows NT programs must use _beginthreadNT or the
  51. _beginthreadfunction instead of the operating system thread-creation
  52. API function because these functions perform initialization required
  53. for correct operation of the run-time library functions. The
  54. _beginthreadNT function provides support for the operating system
  55. security. These functions are available only in the multithread
  56. libraries.
  57.  
  58.    OUCH!!!!
  59.  
  60. If you look in bc45\source\classlib you'll find the makefile for
  61. recompiling the bids library (including the tthread classes) - read
  62. the makefile, it tells you how to compile for MT, DLL's, etc..
  63.  
  64. Hope this fixes your problem....
  65.  
  66.  
  67. -------------------------------------------
  68. Patrick Bennett
  69. Acraline Products, Inc.
  70.  pbennett@acraline.com / CIS: 74103,2115
  71.